﻿//Write a program that reads two positive integer numbers and prints how many numbers p exist between them such that the reminder of the division by 5 is 0 (inclusive). 
//Example: p(17,25) = 2.

using System;

class NumberDividedBy5Limited
{
    static void Main()
    {
        Console.Write("Enter first positive integer number: ");
        string firstIntegerNumberString = Console.ReadLine();
        Console.Write("Enter second positive integer number: ");
        string secondIntegerNumberString = Console.ReadLine();
        uint firstIntegerNumber;
        uint secondIntegerNumber;
        if (
            uint.TryParse(firstIntegerNumberString, out firstIntegerNumber) && 
            uint.TryParse(secondIntegerNumberString, out secondIntegerNumber) 
            )
        {
            if (firstIntegerNumber < secondIntegerNumber)
            {
                uint numbersExistBeforeFirst;
                if (firstIntegerNumber == 0)
                    numbersExistBeforeFirst = firstIntegerNumber / 5;
                else
                    numbersExistBeforeFirst = (firstIntegerNumber - 1) / 5;
                uint numberExistBeforeSecond = secondIntegerNumber / 5;
                uint numberExistInInterval = numberExistBeforeSecond - numbersExistBeforeFirst;
                Console.WriteLine("p({0},{1}) = {2}", firstIntegerNumber, secondIntegerNumber, numberExistInInterval);
            }
            else
                Console.WriteLine("First number must be bigger than second !");
        }
        else
        {
            Console.WriteLine("The numbers must be positive integer !");
        }
    }
}
